Diffraction gratings are optical components with periodic structures that can split and diffract light into several beams travelling into different directions. The directions of these beams depend on the spacing of the grating and the wavelength of the light. In some examples, a diffraction grating is made up of a set of slots with a spacing wider than the wavelength of the light to cause diffraction. After the light interacts with the grating, the diffracted light is composed of the sum of interfering waves emanating from each slot in the grating. Depths of the slots affect the path length of the waves to each slot, which accordingly affect the phases of the waves from each of the slots and thus the diffractive efficiencies of the slots. If the slots have a uniform depth, the slots in the grating may have a uniform diffractive efficiency. If the slots have non-uniform depths, the slots in the grating may have non-uniform diffractive efficiencies.